<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>util - ClueLib</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/prettify.js"></script></head><body class="FramedContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!--  Generated by Natural Docs, version 1.52 -->
<!--  http://www.naturaldocs.org  -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->




<div id=Content><div class="CClass"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="util"></a>util</h1><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">virtual class util</td></tr></table></blockquote><p><span class="virtual">virtual</span> Provides several utility functions.</p><h4 class=CHeading>See Also</h4><p><a href="cl_putil-svh.html#putil" class=LClass id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">putil</a></p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#util" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">util</a></td><td class=SDescription><span class="virtual">virtual</span> Provides several utility functions.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#util.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#util.num_oct_digits" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">num_oct_digits</a></td><td class=SDescription><span class="static">static</span> Returns the number of octal digits required to represent the specified binary digits.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#util.num_dec_digits" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">num_dec_digits</a></td><td class=SDescription><span class="static">static</span> Returns the number of decimal digits required to represent the specified binary digits.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#util.num_hex_digits" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">num_hex_digits</a></td><td class=SDescription><span class="static">static</span> Returns the number of hexadecimal digits required to represent the specified binary digits.</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="util.Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="util.num_oct_digits"></a>num_oct_digits</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>static function int unsigned num_oct_digits(</td><td class="PTypePrefix  prettyprint " nowrap>int&nbsp;</td><td class="PType  prettyprint " nowrap>unsigned&nbsp;</td><td class="PParameter  prettyprint " nowrap>num_bin_digits</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p><span class="static">static</span> Returns the number of octal digits required to represent the specified binary digits.</p><h4 class=CHeading>Argument</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>num_bin_digits</td><td class=CDLDescription>The number of binary digits.</td></tr></table><h4 class=CHeading>Returns</h4><p>The number of octal digits required to represent <b>num_bin_digits</b>.</p><h4 class=CHeading>Example</h4><blockquote><pre class="prettyprint">assert( util::num_oct_digits( 3 ) == 1 ); //  3'b111 -&gt; 1'o7
assert( util::num_oct_digits( 4 ) == 2 ); // 4'b1111 -&gt; 2'o17</pre></blockquote></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="util.num_dec_digits"></a>num_dec_digits</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>static function int unsigned num_dec_digits(</td><td class="PTypePrefix  prettyprint " nowrap>int&nbsp;</td><td class="PType  prettyprint " nowrap>unsigned&nbsp;</td><td class="PParameter  prettyprint " nowrap>num_bin_digits</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p><span class="static">static</span> Returns the number of decimal digits required to represent the specified binary digits.</p><h4 class=CHeading>Argument</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>num_bin_digits</td><td class=CDLDescription>The number of binary digits.</td></tr></table><h4 class=CHeading>Returns</h4><p>The number of decimal digits required to represent <b>num_bin_digits</b>.</p><h4 class=CHeading>Example</h4><blockquote><pre class="prettyprint">assert( util::num_dec_digits( 3 ) == 1 ); //  3'b111 -&gt; 1'd7
assert( util::num_dec_digits( 4 ) == 2 ); // 4'b1111 -&gt; 2'd15</pre></blockquote></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="util.num_hex_digits"></a>num_hex_digits</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>static function int unsigned num_hex_digits(</td><td class="PTypePrefix  prettyprint " nowrap>int&nbsp;</td><td class="PType  prettyprint " nowrap>unsigned&nbsp;</td><td class="PParameter  prettyprint " nowrap>num_bin_digits</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p><span class="static">static</span> Returns the number of hexadecimal digits required to represent the specified binary digits.</p><h4 class=CHeading>Argument</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>num_bin_digits</td><td class=CDLDescription>The number of binary digits.</td></tr></table><h4 class=CHeading>Returns</h4><p>The number of hexadecimal digits required to represent <b>num_bin_digits</b>.</p><h4 class=CHeading>Example</h4><blockquote><pre class="prettyprint">assert( util::num_hex_digits( 3 ) == 1 ); //  3'b111 -&gt; 1'h7
assert( util::num_hex_digits( 4 ) == 1 ); // 4'b1111 -&gt; 1'hF</pre></blockquote></div></div></div>

</div><!--Content-->



<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CClass><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">virtual class util</td></tr></table></blockquote><span class="virtual">virtual</span> Provides several utility functions.</div></div><div class=CToolTip id="tt2"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>static function int unsigned num_oct_digits(</td><td class="PTypePrefix  prettyprint " nowrap>int&nbsp;</td><td class="PType  prettyprint " nowrap>unsigned&nbsp;</td><td class="PParameter  prettyprint " nowrap>num_bin_digits</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><span class="static">static</span> Returns the number of octal digits required to represent the specified binary digits.</div></div><div class=CToolTip id="tt3"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>static function int unsigned num_dec_digits(</td><td class="PTypePrefix  prettyprint " nowrap>int&nbsp;</td><td class="PType  prettyprint " nowrap>unsigned&nbsp;</td><td class="PParameter  prettyprint " nowrap>num_bin_digits</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><span class="static">static</span> Returns the number of decimal digits required to represent the specified binary digits.</div></div><div class=CToolTip id="tt4"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>static function int unsigned num_hex_digits(</td><td class="PTypePrefix  prettyprint " nowrap>int&nbsp;</td><td class="PType  prettyprint " nowrap>unsigned&nbsp;</td><td class="PParameter  prettyprint " nowrap>num_bin_digits</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><span class="static">static</span> Returns the number of hexadecimal digits required to represent the specified binary digits.</div></div><div class=CToolTip id="tt5"><div class=CClass><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>virtual class putil #(</td><td class="PType  prettyprint " nowrap>type&nbsp;</td><td class="PParameter  prettyprint " nowrap>T</td><td class="PDefaultValuePrefix  prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue  prettyprint " width=100%> int</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><span class="virtual">virtual</span> Provides a parameterized utility function.</div></div><!--END_ND_TOOLTIPS-->

<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>